package core.proto.annotation;

import org.jdesktop.swingx.mapviewer.GeoPosition;

import core.proto.Util;
import static app.constants.CollabVizConstants.*;

public class MapAnnotationModel extends AnnotationModel {
	private GeoPosition waypointIconPos;
	private GeoPosition waypointTextPos;

	public MapAnnotationModel(String userText, String docKey, 
			GeoPosition iconPos, GeoPosition txtPos){

		super(userText, docKey, AnnotationLocation.MAP);
		
		this.waypointIconPos = iconPos;
		this.waypointTextPos = txtPos;
	}
	
	public GeoPosition getWaypointIconPos() {
		return waypointIconPos;
	}
	public void setWaypointIconPos(GeoPosition waypointIconPos) {
		this.waypointIconPos = waypointIconPos;
	}
	public GeoPosition getWaypointTextPos() {
		return waypointTextPos;
	}
	public void setWaypointTextPos(GeoPosition waypointTextPos) {
		this.waypointTextPos = waypointTextPos;
	}
	
	public MapAnnotationModel (String tokens[]) {
		super(tokens);
		this.waypointIconPos = new GeoPosition(Double.valueOf(tokens[3]), Double.valueOf(tokens[4]));
		this.waypointTextPos = new GeoPosition(Double.valueOf(tokens[5]), Double.valueOf(tokens[6]));
	}
	
	@Override
	public String toSaveString() {
		String base = super.toBaseSaveString();
		String custom = Util.joinString(ANNOTATION_DELIMITER, 
				this.waypointIconPos.getLatitude(),
				this.waypointIconPos.getLongitude(),
				this.waypointTextPos.getLatitude(),
				this.waypointTextPos.getLongitude());
		return String.format("%s%s%s", base, ANNOTATION_DELIMITER, custom) + "<END>";
	}
	

}
